<table width="100%" border="0" cellpadding="0" cellspacing="0" class="guide">
	<tr>
		<td>
			<span style="float: left;">后台管理中心&nbsp;&raquo;&nbsp;产品管理</span>
			<span style="float: right;">
			    <a href="./?controller=account&action=daysadd">+ 添加</a>
				<a href="javascript:history.go(-1);">&lt;- 返回</a>
			</span>
		</td>
	</tr>
</table>

<div align="center" style="margin-bottom: 8px;">
	<form action="./?controller=account&action=days" method="POST">
	产品
	<select name="pid">
		<option value="0">不限</option>
<?php
foreach ($this->product as $v)
{
	$selected = $this->pid == $v['id'] ? ' selected' : '';
	echo <<<EOF
		<option value="{$v['id']}" {$selected}>{$v['name']}</option>
EOF;
}
?>
	</select>
	&nbsp;&nbsp;
	<input type="submit" value="查询">
	</form>
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
	<tr class="header">
		<td colspan="7">产品天数列表</td>
	</tr>
	<tr class="category" align="center">
		<td width="10%">ID</td>
		<td width="20%">名称</td>
		<td width="10%">所属产品</td>
		<td width="10%">天数</td>
		<td width="10%">价格</td>
		<td width="20%">图片</td>
		<td width="10%">操作</td>
	</tr>
<?php
foreach ($this->data as $v)
{
	$img = '<img src="'.DOMAIN.$v['img'].'" width="200" />';
	$pname = '';
	foreach ($this->product as $v2){
	    if($v['pid'] == $v2['id']){
	        $pname = $v2['name'];
	    }
	}
	
	echo <<<EOF
	<tr>
		<td class="altbg1" align="center">{$v['id']}</td>
		<td class="altbg2" align="center">{$v['name']}</td>
		<td class="altbg1" align="center">{$pname}</td>
		<td class="altbg2" align="center">{$v['days']}</td>
		<td class="altbg1" align="center">{$v['money']}</td>
		<td class="altbg2" align="center">{$img}</td>
		<td class="altbg1" align="center">
		    <a href="./?controller=account&action=daysadd&id={$v['id']}">编辑</a><br />
			<a href="javascript:confirmDelete('./?controller=account&action=daysdelete&id={$v['id']}')">删除</a>
		</td>
	</tr>
EOF;
}
?>
	<tr class="category">
		<td align="center" colspan="7">
			<?php echo $this->paging; ?>
		</td>
	</tr>
</table>
